<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实例5</title>
</head>

<body>
    <p>[20] 转换为其他类型:</p>

    <p id="demo" style="font-family:courier"></p>

    <script>
        var x = [20];
        document.getElementById("demo").innerHTML =
            "Number : " + Number(x) + "<br />" +
            "String : " + String(x) + "<br />" +
            "Boolean: " + Boolean(x);
    </script>
</body>

</html>